﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MiserBlogData.Entities;
using MiserDB.MySql;
using NHibernate;
using System.Reflection;
using log4net;
using System.Web.Routing;

namespace MiserBlogMVC.Controllers
{
    public class CommentController : Controller
    {
        //
        // GET: /Comment/

        public ActionResult Add(int? id)
        {

            if (id.HasValue)
            {

            }
            

            //MiserBlogData.Entities.Comment comment = MiserBlogData.Entities.A_Data.Create<MiserBlogData.Entities.Comment>();
            ////MiserDB.DataHelp.DataHelp articelData = new MiserDB.DataHelp.DataHelp();
            ////Article article = articelData.GetData<Article>(id.Value);
            ////articelData.Flush();
            ////comment.Article = article;
            ////comment.Article.Comments += 1;
            //comment.Content = Request["txtComment"];
            //comment.CDate = DateTime.Now;
            //comment.State = 1;
            //comment.Person.AddComment(comment);

            //MiserDB.DataHelp.QueryHelper data = new MiserDB.DataHelp.QueryHelper();

            //#region 下面的代码上提 
            ////MiserDB.DataHelp.DataHelp d = new MiserDB.DataHelp.DataHelp();
            ////d.Session.Clear();
            //Article a = data.GetData<Article>(id.Value);
            //a.Comments++;
            //data.Update<Article>(a);
            ////d.Flush(); //注释掉了不进行update操作
            //data.Flush();
            //#endregion 

            //comment.Article = a;
            //data.Save<MiserBlogData.Entities.Comment>(comment);
            //data.Save<MiserBlogData.Entities.A_Person>(comment.Person);

            

            return View();
        }

    }
}
